﻿function showLoading(contentId, useContentSize) {
    $("#pnlLoading" + contentId).remove();
    var extra = 25;
    if (useContentSize === true) extra = 0;
    var content;
    if (contentId === "")
        content = $("body");
    else
        content = $("#" + contentId);
    var position = content.position();
    var loadingPnlHtml = "<div id='pnlLoading" + contentId + "' class='pnlLoading'>";
    loadingPnlHtml += "<img id='loading' src='../../content/img/loading.gif' />";
    loadingPnlHtml += "</div>";
    $(loadingPnlHtml).css({ position: 'absolute', top: position.top,
        left: position.left, opacity: 0.6, height: content.height() + extra, width: content.width() + extra
    }).appendTo($("body")).show();
}

function hideLoading(contentId) {
    $("#pnlLoading" + contentId).fadeOut(300, function () {
        $(this).remove();
    });
}